package com.chat.room;

import java.io.IOException;
import java.net.Socket;
import java.util.List;

/**
 * Created by shirenchuang on 2017/4/3.
 */
public class Room {

    private List<Socket> sockets;

    private String name ;

    private Integer roomid ;


    public Room(String name, Integer roomid) {
        this.name = name;
        this.roomid = roomid;
    }

    public Room(Integer roomid) {
        this.roomid = roomid;
    }

    public void joinRoom(Socket socket){
        sockets.add(socket);
    }
    public void outRoom(Socket socket) throws IOException {
        sockets.remove(socket);
        socket.close();
    }

    public List<Socket> getSockets() {
        return sockets;
    }

    public void setSockets(List<Socket> sockets) {
        this.sockets = sockets;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getRoomid() {
        return roomid;
    }

    public void setRoomid(Integer roomid) {
        this.roomid = roomid;
    }
}
